package cn.neusoft.service.impl;

import cn.neusoft.domain.CargoDistributeBill;
import cn.neusoft.mapper.DistributeBillMapper;
import cn.neusoft.service.DisBillService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class DisBillImp implements DisBillService {

    @Autowired
    private DistributeBillMapper distributeBillMapper;
    @Override
    public List<CargoDistributeBill> queryAllDisBill() {
        return distributeBillMapper.getAll();
    }
    @Override
    public int changeDisBill(CargoDistributeBill cargoDistributeBill) {
        int ans = 0;

        if(cargoDistributeBill != null){
            ans = distributeBillMapper.update(cargoDistributeBill);
        }

        return ans;
    }



    @Override
    public int deleteDisBill(int billID) {
        int ans = 0;

        ans = distributeBillMapper.deleteByID(billID);

        return ans;
    }
    @Override
    public int generateDisBill(CargoDistributeBill cargoDistributeBill) {
        int ans = 0;

        if(cargoDistributeBill != null){
            ans = distributeBillMapper.insert(cargoDistributeBill);
        }

        return ans;

    }

    @Override
    public CargoDistributeBill getDisBillByID(int id) {
        return distributeBillMapper.findByID(id);
    }


}
